﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;
using Wolfut.MirageEE.Domain.CommonUtilities;

namespace Wolfut.MirageEE.Domain.Procurement
{
    /// <summary>
    /// 销售订单信息
    /// </summary>
    /// <remarks>
    /// Author: Bruce
    /// Date: 2009-03-15
    /// </remarks>
    [ActiveRecord("SALES_ORDERS")]
    public class SalesOrderOutStock : PersistentObjectWithGuid
    {
        #region 客户ID
        private string customerID = string.Empty;
        /// <summary>
        /// 客户ID
        /// </summary>
        [Property("CUSTOMER_ID")]
        [ValidateNonEmpty, ValidateLength(0, 40, "客户ID超长")]
        public virtual string CustomerID
        {
            get { return customerID; }
            set { customerID = value; }
        }
        #endregion

        #region 销售订单号
        private string saleOrderCode = string.Empty;
        /// <summary>
        /// 销售订单号
        /// </summary>
        [Property("SALE_ORDER_CODE")]
        [ValidateIsUniqueInSameTransactionWithString(false, "数据库中已经存在销售订单号")]
        [ValidateNonEmpty, ValidateLength(0, 100, "销售订单号 超长")]
        public virtual string SaleOrderCode
        {
            get { return saleOrderCode; }
            set { saleOrderCode = value; }
        }
        #endregion        

        #region 日期
        private DateTime salesOrderDate = DateTime.Now;
        /// <summary>
        /// 订单日期
        /// </summary>
        [Property("SALE_ORDER_DATE")]
        public virtual DateTime SalesOrderDate
        {
            get { return salesOrderDate; }
            set { salesOrderDate = value; }
        }
        #endregion

        #region 项目ID
        private string projectID = string.Empty;
        /// <summary>
        /// 项目
        /// </summary>
        [Property("PROJECT_ID")]
        [ValidateNonEmpty, ValidateLength(0, 40, "项目ID超长")]
        public virtual string ProjectID
        {
            get { return projectID; }
            set { projectID = value; }
        }
        #endregion

        #region 币别代码
        private string currencyCode = string.Empty;
        /// <summary>
        /// 币别代码
        /// </summary>
        [Property("CURRENCY_CODE")]
        [ValidateNonEmpty, ValidateLength(0, 20, "币别代码超长")]
        public virtual string CurrencyCode
        {
            get { return currencyCode; }
            set { currencyCode = value; }
        }
        #endregion

        #region 销售人员
        private string salesMan = string.Empty;
        /// <summary>
        /// 销售人员
        /// </summary>
        [Property("SALESMAN")]
        [ValidateNonEmpty, ValidateLength(0, 100, "销售人员内容超长")]
        public virtual string SalesMan
        {
            get { return salesMan; }
            set { salesMan = value; }
        }
        #endregion

        #region 客户订单号（销售单号）
        private string customerOrderCode = string.Empty;
        /// <summary>
        /// 客户订单号
        /// </summary>
        [Property("CUSTOMER_ORDER_CODE")]
        [ValidateNonEmpty, ValidateLength(0, 100, "客户订单号（销售单号）超长")]
        public virtual string CustomerOrderCode
        {
            get { return customerOrderCode; }
            set { customerOrderCode = value; }
        }
        #endregion

        #region 交货日期
        private DateTime deliveryDate = DateTime.Now;
        /// <summary>
        /// 交货日期
        /// </summary>
        [Property("DELIVERY_DATE")]
        public virtual DateTime DeliveryDate
        {
            get { return deliveryDate; }
            set { deliveryDate = value; }
        }
        #endregion

        #region 送货地址
        private string deliveryAddress = string.Empty;
        [Property("DELIVERY_ADDRESS")]
        [ValidateNonEmpty, ValidateLength(0, 100, "送货地址超长")]
        public virtual string DeliveryAddress
        {
            get { return deliveryAddress; }
            set { deliveryAddress = value; }
        }
        #endregion        

        #region 备注
        private string remarks = string.Empty;
        [Property("REMARKS")]
        [ValidateNonEmpty, ValidateLength(0, 2000, "备注超长")]
        public virtual string Remarks
        {
            get { return remarks; }
            set { remarks = value; }
        }
        #endregion        

        #region 收款方式
        private string collectionBillMode = string.Empty;
        /// <summary>
        /// 收款方式
        /// </summary>
        [Property("COLLECTION_BILL_METHOD")]
        [ValidateNonEmpty, ValidateLength(0, 100, "收款方式超长")]
        public virtual string CollectionBillMode
        {
            get { return collectionBillMode; }
            set { collectionBillMode = value; }
        }
        #endregion

        #region 收款条件
        private string collectionBillCondition = string.Empty;
        [Property("COLLECTING_BILL_CONDITION")]
        [ValidateNonEmpty, ValidateLength(0, 100, "收款条件内容超长")]
        public virtual string CollectionBillCondition
        {
            get { return collectionBillCondition; }
            set { collectionBillCondition = value; }
        }
        #endregion

        #region 优惠
        private decimal discount;
        /// <summary>
        /// 优惠
        /// </summary>
        [Property("DISCOUNT")]
        public virtual decimal Discount
        {
            get { return discount; }
            set { discount = value; }
        }
        #endregion                

        #region 账期
        private short collectionPeriod;
        /// <summary>
        /// 账期
        /// </summary>
        [Property("COLLECTION_PERIOD")]        
        public virtual short CollectionPeriod
        {
            get { return collectionPeriod; }
            set { collectionPeriod = value; }
        }
        #endregion

        #region 订单状态
        private SaleOrderState orderState = SaleOrderState.NoOutWarehouse;
        /// <summary>
        /// 订单状态
        /// </summary>
        [Property("ORDER_STATE")]
        public virtual SaleOrderState OrderState
        {
            get { return orderState; }
            set { orderState = value; }
        }
        #endregion

        #region 审核人
        private string auditingBy = string.Empty;
        [Property("AUDITING_BY")]
        [ValidateLength(0, 40, "审核人超长")]
        public virtual string AuditingBy
        {
            get { return auditingBy; }
            set { auditingBy = value; }
        }
        #endregion

        #region 审核状态
        private AuditState auditStates = AuditState.NoAudit;
        [Property("AUDITING_STATE")]
        public virtual AuditState AuditStates
        {
            get { return auditStates; }
            set { auditStates = value; }
        }
        #endregion

        #region 审核时间
        private DateTime auditingDate = DateTime.Now;
        [Property("AUDITING_DATE")]
        public virtual DateTime AuditingDate
        {
            get { return auditingDate; }
            set { auditingDate = value; }
        }
        #endregion       

        #region 制单人
        private string producerBy = string.Empty;
        [Property("PRODUCER_BY")]
        [ValidateNonEmpty, ValidateLength(0, 40, "制单人超长")]
        public virtual string ProducerBy
        {
            get { return producerBy; }
            set { producerBy = value; }
        }
        #endregion        

        #region 是否删除
        private bool isDeleted;
        [Property("IS_DELETED")]
        [ValidateNonEmpty]
        public virtual bool IsDeleted
        {
            get { return isDeleted; }
            set { isDeleted = value; }
        }
        #endregion
    }
}
